<#include "/includes/vars.inc">  
<@pp.dropOutputFile />
<#if includeSettings>
    <#assign settingsName = config.settings.@name[0]!"Settings">
    <#assign managedBean = settingsName?uncap_first+"Controller">
   <@pp.changeOutputFile name="${webDir}/jeecode/${settingsName?uncap_first}/${settingsName}.xhtml" />
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>
            <p:panel header="${r"#{"}msg.${settingsName?uncap_first}${r"}"}">
                <h:form>
                    <h:panelGroup id="data">
                        <p:messages id="errors" redisplay="false"/>
                        <h:panelGrid columns="2" cellpadding="5">
                        	<#list config.settings.setting as setting>
					            <#if setting.@type="Date">
				        <h:outputLabel for="${setting.@name}" value="${r"#{"}msg.${settingsName?uncap_first}${setting.@name?cap_first}${r"}"}:" />
				        <p:calendar id="${setting.@name}" pattern="${config.date.@pattern}"  value="${r"#{"}${managedBean}.${setting.@name?uncap_first}${r"}"}" title="${r"#{"}msg.${settingsName?uncap_first}${setting.@name?cap_first}${r"}"}" />
					            <#elseif setting.@type?cap_first = "Boolean">
				        <h:outputLabel for="${setting.@name}" value="${r"#{"}msg.${settingsName?uncap_first}${setting.@name?cap_first}${r"}"}:" />
				        <h:selectBooleanCheckbox id="${setting.@name}" value="${r"#{"}${managedBean}.${setting.@name}${r"}"}" />
					            <#elseif setting.@type="String" && setting.@size[0]??  && (setting.@size?number > 256) >
				        <h:outputLabel for="${setting.@name}" value="${r"#{"}msg.${settingsName?uncap_first}${setting.@name?cap_first}${r"}"}:" />
				        <h:inputTextarea rows="5" cols="50" id="${setting.@name}" value="${r"#{"}${managedBean}.${setting.@name?uncap_first}${r"}"}" title="${r"#{"}msg.${settingsName?uncap_first}${setting.@name?cap_first}${r"}"}" />
					            <#elseif setting.@type="String" >
			        	<h:outputLabel for="${setting.@name}" value="${r"#{"}msg.${settingsName?uncap_first}${setting.@name?cap_first}${r"}"}:" />
				        <h:inputText id="${setting.@name}" size="50" value="${r"#{"}${managedBean}.${setting.@name?uncap_first}${r"}"}" title="${r"#{"}msg.${settingsName?uncap_first}${setting.@name?cap_first}${r"}"}" />
					            <#else>
				        <h:outputLabel for="${setting.@name}" value="${r"#{"}msg.${settingsName?uncap_first}${setting.@name?cap_first}${r"}"}:" />
				        <h:inputText id="${setting.@name}" value="${r"#{"}${managedBean}.${setting.@name?uncap_first}${r"}"}" title="${r"#{"}msg.${settingsName?uncap_first}${setting.@name?cap_first}${r"}"}" />   	
					            </#if>	
                        	</#list>
                        </h:panelGrid>
                        <p:separator />
                        <p:spacer height="5" />  
                        <p:commandButton update="errors,data"
                                         actionListener="${r"#{"}${managedBean}.saveSettings${r"}"}"
                                         value="${r"#{"}msg.save${r"}"}"
                                         icon="ui-icon ui-icon-disk"
                                         />
                        <p:spacer width="5" />  
                        <p:commandButton update="errors,data"
                                         actionListener="${r"#{"}${managedBean}.restoreDefaults${r"}"}"
                                         value="${r"#{"}msg.restoreDefaults${r"}"}"
                                         icon="ui-icon ui-icon-refresh"
                                         />
                    </h:panelGroup>
                </h:form>
            </p:panel>
    </ui:composition>
</html>

<#--
	<@pp.changeOutputFile name="${webDir}/jeecode/${settingsName?uncap_first}/${settingsName}.xhtml" />
	<?xml version='1.0' encoding='UTF-8' ?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml"
	      xmlns:h="http://java.sun.com/jsf/html"
	      xmlns:ui="http://java.sun.com/jsf/facelets"
	      xmlns:p="http://primefaces.org/ui">
	
	    <ui:composition template="/template.xhtml">
	        <ui:define name="body">
	            <ui:include src="/jeecode/${settingsName?uncap_first}/${settingsName}.xhtml" />
	        </ui:define>
	    </ui:composition>
	</html>
-->
</#if>
